/*
 * @Descripttion:
 * @Author: 张正兴
 * @Date: 2022-03-28 15:59:08
 * @LastEditors: 张正兴
 */
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls";
import * as THREE from "three";

/**
 * 按中心点旋转
 */
export function controls(camera: any, renderer: any) {
  const controls = new OrbitControls(camera, renderer);
  controls.target = new THREE.Vector3(0, 0, 0); //控制焦点
  controls.autoRotate = false; // 将自动旋转关闭
  controls.minDistance = 10; // 最小倍数
  controls.maxDistance = 320; // 最大倍数

  // controls = new OrbitControls(this.camera, this.renderer.domElement);
  // controls.target = new THREE.Vector3(0, 0, 0); //控制焦点
  // controls.autoRotate = false; //将自动旋转关闭
  return controls;
}
